#define dualualibs_c

#include <lua.h>

#include <lualib.h>
#include <lauxlib.h>

#include "dualualibs.h"

static const luaL_Reg lualibs[] = {
  	{LUA_SCREENLIBNAME, luaopen_screen},
  	{LUA_CONTROLSLIBNAME, luaopen_controls},
  	{LUA_IMAGELIBNAME, luaopen_image},
  	{LUA_COLORLIBNAME, luaopen_color},
  	{LUA_VIDEOLIBNAME, luaopen_video},
  	{LUA_VRAMLIBNAME, luaopen_vram},
  	{NULL, NULL}
};

LUALIB_API void dualua_openlibs (lua_State *L) {
	const luaL_Reg *lib = lualibs;
  	for (; lib->func; lib++) {
    		lua_pushcfunction(L, lib->func);
    		lua_pushstring(L, lib->name);
    		lua_call(L, 1, 0);
  	}
}

